package com.yixing.tech.common.security;


import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 用户凭证
 *
 * @author <a href="mailto:brucezhang_jjz@163.com">zhangj</a>
 * @since 1.0.0
 */
@Setter
@Getter
public class UserCertificate {

    /**
     * 用户Id
     */
    private String userId;

    /**
     * 用户名
     */
    private String username;

    /**
     * 访问令牌
     */
    private String token;

    /**
     * 刷新令牌
     */
    private String refreshToken;

    /**
     * 权限集合
     */
    private String permissions;

    /**
     * 是否超管
     */
    private boolean superAdmin;

    private List<Application> applications;

    private Tenant tenant;

    public String getTenantId() {
        return tenant == null? null: tenant.getId();
    }

    public UserCertificate() {
    }

    @Setter
    @Getter
    static public class Application {

        private String id;

    }

    @Setter
    @Getter
    static public class Tenant {
        private String id;
        private String code;
        private String picUrl;

    }
}
